﻿@model ThienVienDiDaTu.Models.TinTuc

@{
    ViewBag.Title = "Tạo tin tức mới";
}

<h2>Tạo tin tức mới</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("NewsCreate", "Admin", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>TinTuc</legend>
        @*<div class="editor-label">
            @Html.LabelFor(model => model.LoaiTin)
        </div>*@
        
        @*<div class="editor-field">
            @Html.DropDownList("ChonNhomTin", new SelectList(ViewBag.listNt))
            
        </div>*@
        <div class="editor-field">
            @Html.DropDownListFor(m=>m.LoaiTinID, ViewBag.listNt as IEnumerable<SelectListItem>)
            
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.NhanDe)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NhanDe)
            @Html.ValidationMessageFor(model => model.NhanDe)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TomTat)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.TomTat)
            @Html.ValidationMessageFor(model => model.TomTat)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.NoiDung)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.NoiDung)
            @Html.ValidationMessageFor(model => model.NoiDung)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LinkAnh)
        </div>
        @Microsoft.Web.Helpers.FileUpload.GetHtml(initialNumberOfFiles: 1, allowMoreFilesToBeAdded: false, includeFormTag: false, addText: "Thêm ảnh", uploadText: "Upload ảnh")
       
                
        <p>
            <input type="submit" value="Tạo mới" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Trở lại danh sách tin tức", "NewsList")
</div>

<script type="text/javascript" id="oi">
    $(document).ready(function () {
        function UpdateCKEditors() {
            $('NoiDung').ckeditorGet().updateElement();
        }

        CKEDITOR.replace('NoiDung',
        {
            filebrowserImageUploadUrl: '/Admin/UploadImage',
            filebrowserUploadUrl: '/Admin/UploadImage'
        });



    });
</script>
